package com.zhang.cicadatravels.main.search;

import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.zhang.cicadatravels.R;
import com.zhang.cicadatravels.base.BaseActivity;
import com.zhang.cicadatravels.main.search.Abroad.AbroadFragment;
import com.zhang.cicadatravels.main.search.home.HomeFragment;
import com.zhang.cicadatravels.main.search.seasons.SeasonsFragment;

import java.util.ArrayList;

/**
 * Created by dllo on 16/6/23.
 */
public class SearchActivity extends BaseActivity {
    private ViewPager viewPager;
    private SearchAdapter adapter;
    private ArrayList<Fragment> fragments;
    private TabLayout tabLayout;

    @Override
    public int initcreate() {
        return R.layout.activity_search;
    }

    @Override
    protected void initview() {
        viewPager = (ViewPager) findViewById(R.id.activity_search_viewpager);
        adapter = new SearchAdapter(getSupportFragmentManager());
        fragments = new ArrayList<>();
        tabLayout = (TabLayout) findViewById(R.id.activity_search_tablayout);


    }

    @Override
    protected void initdata() {
        fragments.add(new AbroadFragment());
        fragments.add(new HomeFragment());
        fragments.add(new SeasonsFragment());

        adapter.setFragments(fragments);
        viewPager.setAdapter(adapter);
        tabLayout.setupWithViewPager(viewPager);


    }
}
